<?php session_start(); ?>
<?php include ("../inc/db_config.inc"); ?>
<?php 
$g_title="修改友情链接";
$g_tab="index";
$g_header=""; 
$g_js='<script type="text/javascript">
$(document).ready(function(){
    $("#getBtn").click(function(){
        var url=$("#link").val();
        getDetail(url);
    })
})
function getDetail(url){
    $("#loadHolder").html("正在获取博客信息...");
    var url="http://api.zhui.cn/content/List.json?zid=3&ActionID=300&KeyName="+url+"&version=2&SoftVersion=2&jsoncallback=?";
    $.getJSON(url,function(json){
        if(json){
            var status=json.StatusInfo.Status;
            var returncode=json.StatusInfo.ReturnCode;
            if(status==0){
                $("#loadHolder").html(returncode).css("color","#f00");
            }else{
                $("#loadHolder").html(returncode).css("color","#080");
                var CItem=json.CItems[0];
                var zid=CItem.ZID;
                var sid=CItem.ID;
                var title=CItem.Title;
                var description=CItem.Summary;
                
                $("#title").val(title);
                $("#z_zid").val(zid);
                $("#z_sid").val(sid);
                $("#description").val(description);
            }
        }
    })
}
</script>';
?>
 <?php include('header.php'); ?>
  <?php
  if(isset($_REQUEST['nid'])&&$_REQUEST['nid']!=""){
    $cata_id=$_REQUEST['nid'];
    $result=mysql_query("select * from blogs where id=$cata_id");
    $row=mysql_fetch_array($result);
  }
  ?>
			<div class="crumb"></div>
			<div class="main">
				<div class="container r">
					<div class="conbox">
						<div class="cb_hd">
							<span class="cb_tl"></span>
							<span class="cb_tr"></span>
							<h2>修改链接</h2>
						</div>
						<div class="cb_bd">
								<form class="sendbox" action="blog_edit_action.php" method="post">
                                <input type="hidden" name="nid" value="<?php echo $row['id']; ?>" />
                                <p>
										<label>链接地址:</label><input id="link" name="links" class="txt" value="<?php echo $row['links']; ?>" type="text"/>
                                        <div style="margin:5px 0 5px 25px;"><button id="getBtn" type="button">获取博客简介</button></div>
                                        <div style="margin: 0 0 0 25px;" id="loadHolder"></div>
									</p>
									<p>
										<label>标题:</label><input id="title" name="title" class="txt" value="<?php echo $row['title']; ?>" type="text"/>
									</p>
                                    <p>
                                        <label>分类:</label>
                                        <select name="cata">
                                            <option value="">请选择</option>
                                        <?php
                                         $result_type=mysql_query("select * from blog_cata");
                                         while($row_type=mysql_fetch_array($result_type)){
                                         ?>
                                            <option value="<?php echo $row_type['id']; ?>" <?php if($row['cata']==$row_type['id']) echo "selected=selected"; ?>><?php echo $row_type['name']; ?></option>
                                            <?php } ?>       
                                        </select>
                                    </p>
									
									<p>
										<label>简介:</label><textarea id="description" name="description"><?php echo $row['description']; ?></textarea>
									</p>
                                    <p>
										<label>ZID:</label><input id="z_zid" name="z_zid" type="text" value="<?php echo $row['z_zid']; ?>"/>
									</p>
                                    <p>
										<label>SID:</label><input id="z_sid" name="z_sid" type="text" value="<?php echo $row['z_sid']; ?>"/>
									</p>
                                    <p>
										<label>分页:</label><input name="z_ps" type="text" value="<?php echo $row['z_ps']; ?>"/>
									</p>
									<p>
										<label>联系人:</label><input name="contact" type="text" value="<?php echo $row['contact']; ?>"/>
									</p>
									<p>
										<input class="sub" type="submit" value="提交"/>
									</p>
								</form>
						</div>
						<div class="cb_ft"></div>
					</div>
				</div>
				<?php include('sidebar.php'); ?>
				<div class="c"></div>
			</div>
		</div>
	</div>
<?php include('footer.php'); ?>